package com.jcl.recruit.elasticsearch.core.tools;

import com.jcl.core.utils.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName Range

 * @Author yyliu
 * @Date 2018/11/2 17:22
 * @Version 1.0
 **/
public class Range {
    Map<String, Map<String, Object>> range = new HashMap<>();
    public Map<String, Map<String, Object>> getRange() {
        return range;
    }
    public void setRange(String key, String from, String to) {
        Map<String, Object> temp = new HashMap<>();
        this.range.put(key, temp);
        if(StringUtils.hasLength(from)){
            temp.put("from", from);
        }
        if(StringUtils.hasLength(from)){
            temp.put("to", to);
        }
    }
    public void setRangeNotV(String key, String gt, String lt) {
        Map<String, Object> temp = new HashMap<>();
        this.range.put(key, temp);
        if(StringUtils.hasLength(gt)){
            temp.put("gt", gt);
        }
        if(StringUtils.hasLength(lt)){
            temp.put("lt", lt);
        }
    }
}
